<template>
<div class="use-clipboard">
  <input type="text" v-model="source"><br/>
  <!-- 这里copy需要带参数 -->
  <button @click="copy(source)">拷贝</button><br/>
  <div>拷贝的内容：{{ text }}</div>
</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useClipboard } from "@vueuse/core";

defineOptions({
  name: "UseClipboard"
})

const source = ref('')
const { text, copy } = useClipboard({ source })
</script>

<style scoped lang="css">
.use-clipboard {

}
</style>
